package com.xwj.validation.basic.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @Author: xiaowajiang
 * @Date: 2022-03-13 15:13
 * @Description: 学生实体
 **/
@Data
@ApiModel(value = "BasicStudentDTO", description = "学生")
public class StudentDTO implements Serializable {
    private static final long serialVersionUID = -2126505372397894307L;

    // 姓名
    @NotBlank(message = "姓名必须填写")
    @ApiModelProperty(value = "姓名", required = true)
    private String name;

    // 电话
    @NotBlank(message = "电话必须填写")
    @Pattern(regexp = "^\\d{3}-\\d{8}$", message = "电话格式不正确")
    @ApiModelProperty(value = "电话", required = true)
    private String phone;

    // 头像
    @NotBlank(message = "头像必须上传")
    @URL(message = "头像地址不正确")
    @ApiModelProperty(value = "头像", required = true)
    private String photo;
}
